package com.snsoft.service.environment;

import java.sql.SQLException;
import java.util.List;

import com.snsoft.bean.SensorInfo;
import com.snsoft.dao.EnvironmentDao;
import com.snsoft.exception.SensorNotFound;

/**
 * 
 * @copyright ：神农大学生软件创新中心 版权所有 © 2017
 * 
 * @author 16计算机弓耀
 * 
 * @version 1.0
 * 
 * @date 2017年11月10日下午2:14:22
 * 
 * @Description TODO
 *	获取单个传感器历史数据接口
 */
public class GetHistoryDataService {
	public List<SensorInfo> getHistoryData(int protocolID, int deviceID, int nodeID, int time) throws SQLException, SensorNotFound{
		EnvironmentDao ed = new EnvironmentDao();
		List<SensorInfo> result = ed.getHistoryData(protocolID, deviceID, nodeID, time);
		if(result.isEmpty()) {
			throw new SensorNotFound("传感器数据不存在");
		}
		return result;
	}
}
